\(\int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx\) [193]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 10 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {\cos (x)}{1+\sin (x)} \]

[Out]

-cos(x)/(1+sin(x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3244, 2727} \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {\cos (x)}{\sin (x)+1} \]

[In]

Int[Sec[x]/(Sec[x] + Tan[x]),x]

[Out]

-(Cos[x]/(1 + Sin[x]))

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 3244

Int[sec[(d_.) + (e_.)*(x_)]^(n_.)*((a_.) + (b_.)*sec[(d_.) + (e_.)*(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)])^(m_)
, x_Symbol] :> Int[1/(b + a*Cos[d + e*x] + c*Sin[d + e*x])^n, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[m + n, 0]
 && IntegerQ[n]

Rubi steps \begin{align*} \text {integral}& = \int \frac {1}{1+\sin (x)} \, dx \\ & = -\frac {\cos (x)}{1+\sin (x)} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(23\) vs. \(2(10)=20\).

Time = 0.03 (sec) , antiderivative size = 23, normalized size of antiderivative = 2.30 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=\frac {2 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )} \]

[In]

Integrate[Sec[x]/(Sec[x] + Tan[x]),x]

[Out]

(2*Sin[x/2])/(Cos[x/2] + Sin[x/2])

Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.10

method result size
default \(-\frac {2}{\tan \left (\frac {x}{2}\right )+1}\) \(11\)
risch \(-\frac {2}{i+{\mathrm e}^{i x}}\) \(13\)

[In]

int(sec(x)/(sec(x)+tan(x)),x,method=_RETURNVERBOSE)

[Out]

-2/(tan(1/2*x)+1)

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.80 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {\cos \left (x\right ) - \sin \left (x\right ) + 1}{\cos \left (x\right ) + \sin \left (x\right ) + 1} \]

[In]

integrate(sec(x)/(sec(x)+tan(x)),x, algorithm="fricas")

[Out]

-(cos(x) - sin(x) + 1)/(cos(x) + sin(x) + 1)

Sympy [F]

\[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=\int \frac {\sec {\left (x \right )}}{\tan {\left (x \right )} + \sec {\left (x \right )}}\, dx \]

[In]

integrate(sec(x)/(sec(x)+tan(x)),x)

[Out]

Integral(sec(x)/(tan(x) + sec(x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.50 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {2}{\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1} \]

[In]

integrate(sec(x)/(sec(x)+tan(x)),x, algorithm="maxima")

[Out]

-2/(sin(x)/(cos(x) + 1) + 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {2}{\tan \left (\frac {1}{2} \, x\right ) + 1} \]

[In]

integrate(sec(x)/(sec(x)+tan(x)),x, algorithm="giac")

[Out]

-2/(tan(1/2*x) + 1)

Mupad [B] (verification not implemented)

Time = 22.47 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int \frac {\sec (x)}{\sec (x)+\tan (x)} \, dx=-\frac {2}{\mathrm {tan}\left (\frac {x}{2}\right )+1} \]

[In]

int(1/(cos(x)*(tan(x) + 1/cos(x))),x)

[Out]

-2/(tan(x/2) + 1)